import { doPost, doGet } from './crud'

import axios from 'axios';
export function getPlayings(page) {
    return doGet("/movie/playings1", { page })
}

export function getComings() {
    return doGet("/movie/comings").then(res => res.data)
}
export function getCinemas() {
    return doGet("/movie/cinemas").then(res => res.data);
}
export function getPlayings1() {
    return doGet("/movie/playings1").then(res => res.data);
}
export function getPlayings2() {
    return doGet("/movie/playings2").then(res => res.data);
}
export function getNews() {
    return doGet("/movie/zixun").then(res => res.data.data.content);
}
export function getDetail(id) {
    return doGet(
        `https://m.maizuo.com/gateway?filmId=${id}&k=4138023`,
        null,
        {
            headers: {
                "X-Host": "mall.film-ticket.film.info"
            }
        },
        // 不使用全局默认的axios实例发起请求（因为它会给所有请求注入authorization请求头，此处我们不需要这个请求头）
        // 而使用一个全新配置的实例
        axios.create({})
    ).then((res) => res.data.data.film);
}